<div class="row">
<div align="center">
    <h2><?php echo __('Send us your order')?></h2>
</div>
<br>
<div class="contact-block cf mb-50">
    <div class="col-xs-12 col-sm-12 col-md-12">
      <form id="frm-order" class="form-horizontal contact-form" method="post">
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="name" id="name" placeholder="<?php echo __('Name')?> (*)">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="email" name="email" id="email" placeholder="Email (*)">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="company" id="company" placeholder="<?php echo __('Company')?>">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="telephone" id="telephone" placeholder="<?php echo __('Telephone')?>">
        </div>
        <div class="form-group col-md-12 mb-25">
          <input class="form-control" type="text" name="logo" id="logo" placeholder="<?php echo __('Url Logo Image')?>">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="chocolate_color" id="chocolate_color" placeholder="<?php echo __('Chocolate Color')?>">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="artwork_color" id="artwork_color" placeholder="<?php echo __('Artwork Color')?>">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="shape" id="shape" placeholder="<?php echo __('Shape')?>">
        </div>
        <div class="form-group col-md-6 mb-25">
          <input class="form-control" type="text" name="position" id="position" placeholder="<?php echo __('Position')?>">
        </div>
        <div class="form-group col-md-12">
          <textarea class="form-control" name="message" id="message" cols="30" rows="4" placeholder="<?php echo __('Other')?>"></textarea>
        </div>
        <div style="clear:both"></div>
        <div class="form-group align-center">
          <button type="button" class="btn btn-primary" id="send"><?php echo __('Send')?></button>
          <p class="text-success" style="display:none"><?php echo __('We will contact to you')?></p>
          <p id="error" class="text-danger" style="display:none"></p>
        </div>
      </form>
    </div>
</div><!-- /contact-block -->
</div>
<script>

$('#send').click(function(){
    $('.text-success').hide();
    $('#error').hide();
    var name = $('#name').val();
    var email = $('#email').val();
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;

    if(name == '' || email== '') {
        $('#error').html('<?php echo __("Please input required fields.")?>').attr('style','color:red').show();
        return;
    } else if(!pattern.test(email)) {
        $('#error').html('<?php echo __("Email not valid.")?>').attr('style','color:red').show();
        $('#email').focus();
        return;
    }
    
    
    var data = $('form').serializeArray(); 
    $.ajax({
        url: '/chocolates/send_us_your_order',
        data: {data: data},
        type: 'post',
        success: function(response){
            if(response == 1) $('.text-success').show();
        }
    });
});
</script>
